<?php

use App\Models\News;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:sanctum');


Route::any('/callback', function (Request $request) {
    Log::channel('base')->info('=====接收消息====='.date('Y-m-d H:i:s'));
    Log::channel('base')->info(json_encode($request->all()));
    return 'success';
});


Route::post('/news', function (Request $request) {
    $new =  News::query()->create([
        'name' => $request->input('name'),
        'content' =>  $request->input('content'),
    ]);
    dd($new->toArray());
});
